package leetcode.day_2020_12_21_12_28;

import leetcode.ListNode;

import java.util.List;

/**
 * 反转链表
 */
public class Offer_24 {
    public ListNode reverseList(ListNode head) {
        if(head == null) return null;
        if(head.next == null) return head;
        ListNode last = reverseList(head.next);
        head.next.next = head;
        head.next = null;
        return last;
    }
}
